package com.dpj.yygh.controller;


import com.dpj.yygh.common.result.Result;
import com.dpj.yygh.model.cmn.Dict;
import com.dpj.yygh.model.hosp.Hospital;
import com.dpj.yygh.service.HospitalService;
import com.dpj.yygh.vo.hosp.HospitalQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

//@CrossOrigin
@Api(tags = "医院管理接口")
@RestController
@RequestMapping("/admin/hosp/hospital")
public class HospitalController {

    @Autowired
    private HospitalService hospitalService;
    //医院列表
    @GetMapping("list/{page}/{limit}")
    public Result getListPage(@PathVariable Integer page, @PathVariable Integer limit, HospitalQueryVo hospitalQueryVo){

        Page<Hospital> selectPage =hospitalService.selectPage(page,limit,hospitalQueryVo);
        return Result.ok(selectPage);
    }

    @ApiOperation("更新医院上线状态")
    @GetMapping("updateHospStatus/{id}/{status}")
    public Result updateHospStatus(@PathVariable String id,@PathVariable Integer status ){
        hospitalService.updateStatus(id,status);
        return Result.ok();
    }


    //医院详细信息
    @ApiOperation("医院详细信息")
    @GetMapping("showHospDetail/{id}")
    public Result showHospDetail(@PathVariable String id){
        Map<String, Object> result=hospitalService.getHospById(id);
        return Result.ok(result);
    }






}
